var bip39 = require('bip39')
var hdkey = require('ethereumjs-wallet/hdkey')
var util = require('ethereumjs-util')
var Tx = require('ethereumjs-tx');
var keythereum = require("keythereum");
var Web3 = require('web3');


//初始化过程
var Web3 = require('web3');

if (typeof web3 !== 'undefined') {
  web3 = new Web3(web3.currentProvider);
} else {
  // set the provider you want from Web3.providers
  web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}


var message = "abc"
var s1 = "\x19Ethereum Signed Message:\n" + message.length + message
var s2 = '\u0019Ethereum Signed Message:\n' + message.length.toString()+message


//const msgHash  = util.rlphash(Buffer.from(s1, 'utf8'))
const msgHash1  = util.hashPersonalMessage(Buffer.from(message, 'utf8'))
const msgHash2 = web3.sha3(s1)

//console.log(msgHash.toString('hex'))
console.log(msgHash1.toString('hex'))
console.log(msgHash2)